<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>用户登录</h1>
    用户名： <input type="text" name="userName" id="userName"><br>
    密码： <input type="password" name="passWord" id="passWord"> <br>
    <input type="button" value="登录" onclick="login()">
    
    <script src="jquery"> </script>
    
    <script>
        function login(){
            $.ajax({
                type:"post",
                url:"/userNew/login",
                data:{
                    userName:$("#userName").val(),
                    passWord:$("#passWord").val()
                },
                success: function(result){
                    if(result){
                        location.href="indexNew.html";
                    }else{
                        alert("用户或密码错误");
                }
                }
            })
        }

    </script>
</body>
</html>